﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Xuanren_FrontEnd.Model;

namespace Xuanren_FrontEnd.Areas.Back.Controllers
{
    public class AboutController : Controller
    {
        private XuanrenTherapyEntities db = new XuanrenTherapyEntities();

        // GET: About
        public ActionResult Index(int id=4)
        {
            {
                var info = db.About.SingleOrDefault(p => p.id == id);
                ViewBag.A = info;
            }
            return View();
        }
        [HttpPost]
        public ActionResult Update(About about)
        {
            var obj = db.About.SingleOrDefault(x => x.id == about.id);//获取指定Id的新闻对象
            obj.CompanyInfo = about.CompanyInfo;
            obj.Telephone = about.Telephone;
            obj.Phone = about.Phone;
            obj.ContactPerson = about.ContactPerson;
            obj.Email = about.Email;
            obj.Address = about.Address;
            obj.Banner = about.Banner;


            int r = db.SaveChanges();
            if (r > 0)
            {
                return Json(new { suc = true, msg = "修改成功" });
            }
            else
            {
                return Json(new { suc = false, msg = "修改失败" });

            }
        }
    }
}